<template>
  <div class="app-container">

    <el-table
      :data="tableData"
    >

      <el-table-column
        sortable
        fixed
        label="browseTime"
        height="100%">

        <template slot-scope="scope">
          {{scope.row.browseTime| dateFormat }}
        </template>

      </el-table-column>

      <el-table-column

        prop="browseId"
        label="browseId"
        width="120">
      </el-table-column>

      <el-table-column
        prop="browseLocation"
        label="browseLocation"
        width="120">
      </el-table-column>

      <el-table-column
        prop="browseReqUrl"
        label="browseReqUrl"
        >
      </el-table-column>

      <el-table-column
        label="操作用户"
        width="120">
        <template slot-scope="scope">
          <span v-if="scope.row.browseBrowser==0"> <i class="el-icon-s-flag"> 其他 </i> </span>
          <span v-else-if="scope.row.browseBrowser==1">1</span>
          <span v-else-if="scope.row.browseBrowser==2">2</span>
        </template>
      </el-table-column>

      <el-table-column
        prop="browseOs"
        label="browseOs">
      </el-table-column>
      <el-table-column
        prop="browseIp"
        label="browseIp"
        width="120">
      </el-table-column>


    </el-table>

    <div class="block">
      <el-pagination
        layout="prev, pager, next"
        :page-size="15"
        :current-page="current"
        :total="total"
        @next-click="nextPage"
        @prev-click="prevPage"
        @current-change="currentChange"
      >
      </el-pagination>
    </div>

  </div>
</template>

<script>


import {browseGet} from "@/api/system";

export default {
  name: "browsr",
  created() {
    this.getOperation(this.current)
  },
  methods: {
    getOperation(page){
      browseGet(page).then(
        res =>{
          this.tableData = res.data.records
          this.total = res.data.total
          this.current = res.data.current
        }
      )
    },
    nextPage(){
      this.getOperation(++this.current)
    },
    prevPage(){
      this.getOperation(--this.current)
    },
    currentChange(val){
      /*修改当前页面为val 来自前端点击数字的值*/
      this.current = val;
      this.getOperation(this.current);
    }
  },
  data() {
    return {
      tableData: [],
      total: 0,
      size: 25,
      current: 1,
      pages: 1
    }
  },

}
</script>

<style scoped>


</style>
